<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>探照灯样式</title>
    <style>
        body,html {
            background-color: #3c3c3c;
            text-align: center;
        }

        .spotlight {
            position: relative;
            display: inline-block;
            font-size: 48px;
        }

        .spotlight::after {
            position: absolute;
            width: 100%;
            height: 100%;
            left: 0;
            right: 0;
            content: attr(title);
            color: white;
            /* infinite：让动画无限循环  alternate：让动画倒放 */
            animation: spotlight 3s ease-in-out infinite alternate;
        }

        @keyframes spotlight {
            0% {
                clip-path: ellipse(32px 32px at 0% 50%);
            }
            100% {
                clip-path: ellipse(32px 32px at 100% 50%);
            }
        }
    </style>
</head>
<body>
    <h1 title="Hello World" class="spotlight">
        Hello World
    </h1>
</body>
</html>